<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
			.box{
				height: 150px;
				/* 水平居中 */
				text-align: center;
				padding-top: 50px;
				 /* FFFFFF  a */
				background-color: rgba(255,255,255,0.2);
			}
			img{
				width: 150px;
			}
			body{
				background-image: url(../img/1.jpg);
			}
		</style>
	</head>
	<body <!-- style="background-image: ;" -->>
		<div class="box">
			<img src="../img/1.jpg" />
			<img src="../img/2.jpg" />
			<img src="../img/3.jpg" />
			<img src="../img/4.jpg" />
			<img src="../img/5.jpg" />
		</div>
		
		<script type="text/javascript">
			window.onload = function() {
				var images = document.getElementsByTagName("img");
				for(var i = 0; i < images.length; i++) {
					images[i].onclick = function() {
						// this 代表当前设置点击事件的对象images[i]
						var imageUrl = this.src;
						console.log(imageUrl);
						//document.body.style.backgroundImage = "url(../img/5.jpg)";
						document.body.style.backgroundImage = "url(" + imageUrl + ")";
					}
				}
			}
		</script>
	</body>
</html>
